<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}API场景组合测试工具{% endblock %}</title>
    <!-- Bootstrap CSS -->
    <link href="{{ url_for('static', filename='vendor/bootstrap/bootstrap.min.css') }}" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="{{ url_for('static', filename='vendor/font-awesome/all.min.css') }}" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet">
    {% block head %}{% endblock %}
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="{{ url_for('index') }}">API场景组合测试工具</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('api.list_apis') }}">API管理</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('scene.list_scenes') }}">场景管理</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('environment.list_environments') }}">环境管理</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('record.list_records') }}">执行记录</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主内容 -->
    <div class="container mt-4">
        {% block content %}{% endblock %}
    </div>

    <!-- 页脚 -->
    <footer class="footer mt-5 py-3 bg-light">
        <div class="container text-center">
            <span class="text-muted">API场景组合测试工具 &copy; 2025</span>
        </div>
    </footer>

    <!-- 本地静态资源 -->
    <script src="{{ url_for('static', filename='vendor/jquery/jquery.min.js') }}"></script>
    <script src="{{ url_for('static', filename='vendor/bootstrap/bootstrap.bundle.min.js') }}"></script>
    <link href="{{ url_for('static', filename='vendor/toastr/toastr.min.css') }}" rel="stylesheet">
    <script src="{{ url_for('static', filename='vendor/toastr/toastr.min.js') }}"></script>
    
    <!-- 资源加载检查 -->
    <script>
    // 检查资源加载状态
    window.addEventListener('load', function() {
        if (typeof jQuery === 'undefined') {
            console.error('jQuery加载失败');
        }
        if (typeof bootstrap === 'undefined') {
            console.error('Bootstrap加载失败');
        }
        if (typeof toastr === 'undefined') {
            console.warn('Toastr加载失败，将使用alert代替通知');
        }
    });
    </script>
    
    <!-- 初始化脚本 -->
    <script>
        // 配置toastr
        if (typeof toastr !== 'undefined') {
            toastr.options = {
                closeButton: true,
                progressBar: true,
                positionClass: 'toast-top-right',
                timeOut: 3000
            };
        } else {
            console.warn('toastr未加载，将使用alert代替');
        }
    </script>
    
    <!-- 通用工具函数 -->
    <script src="{{ url_for('static', filename='js/utils.js') }}"></script>
    
    <!-- API功能JS - 移至api/index.html中加载 -->
    {% block api_scripts %}{% endblock %}
    
    <!-- 主应用JS -->
    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
    {% block scripts %}{% endblock %}
</body>
</html>